import { Injectable } from '@nestjs/common';
import axios from 'axios';
import { SupChatGptDto } from './dto/sup-chat-gpt.dto';
const CHATDOMAIN = 'http://supportal.supcon.com/chat-api/chat-process';
const PARENT_MESSAGE_ID = 'chatcmpl-6ybgZ9O2HU8C65p4borepy9NvrR3K';
@Injectable()
export class ChatGptService {
  async getSupGPTResponse(supChatGptDto: SupChatGptDto) {
    console.log('supChatGptDto', supChatGptDto);

    const res = await axios({
      url: `${CHATDOMAIN}`, // TODO CHATDOMAIN 提取到外部
      method: 'POST',
      data: {
        prompt: supChatGptDto.prompt,
        options: {
          parentMessageId: PARENT_MESSAGE_ID,
        },
      },
    });
    return res?.data;
  }
}
